package chapter_12_flyweight.sample;

/**
 * Created by CharloYao on 2017/3/24.
 */
public class Client {

    public static void main(String[] args) {
        FlyweightFactory factory = FlyweightFactory.getInstance();
        Flyweight f1 = factory.getFlyweight("fly");
        Flyweight f2 = factory.getFlyweight("fly");
        Flyweight f3 = factory.getFlyweight("fly");
        Flyweight f4 = factory.getFlyweight("fly");

        System.out.println(factory.getPoolLength());        //打印1;说明只生成了一个对象
    }
}
